#include "Robot.h"
#include "MoveHandler.h"
#include "HitPointHandler.h"
#include <stdio.h>


Robot::Robot(const std::string& type): robotType(type)
{
	MoveHandler moveHandler(this);
	HitPointHandler hitPointHandler(this);

	AddEventHandler(&moveHandler);
	AddEventHandler(&hitPointHandler);
}


Robot::~Robot()
{
}

void Robot::MoveLeft()
{
	printf("Robot %s moving left!\n", robotType.c_str());

	SetCellX( CellX() - 1 );
}

void Robot::MoveRight()
{
	printf("Robot %s moving right!\n", robotType.c_str());

	SetCellX( CellX() + 1 );
}

void Robot::MoveUp()
{
	printf("Robot %s moving up!\n", robotType.c_str());

	SetCellY( CellY() - 1 );
}

void Robot::MoveDown()
{
	printf("Robot %s moving down!\n", robotType.c_str());

	SetCellY( CellY() + 1 );
}

void Robot::HitPoint(unsigned int *x, unsigned int *y)
{
	*x = 4;
	*y = 9;
}


const std::string& Robot::ToString() const
{
	return robotType;
}